﻿Public Class SanBay
    Inherits DataProvider

    Public Function lay_dataset_san_bay() As DataSet
        Dim sqlstr As String = "SELECT * FROM SanBay"
        Return GetDT(sqlstr)
    End Function

    Public Function lay_dataset_san_bay_co_tham_chieu() As DataSet
        Dim sqlstr As String = "SELECT * FROM SanBay"
        Return GetDT(sqlstr)
    End Function

    Public Function them_san_bay(ByVal dto_sanbay As DTO.SanBay)
        Dim sql_query As String = "INSERT INTO SanBay(Ten) VALUES('" + dto_sanbay.Ten + "')"
        If IsNothing(Me.SaveData(sql_query)) Then
            Return Nothing
        End If
        Dim id As Integer = Integer.Parse(GetValue("SELECT max(id) from SanBay"))
        Return id
    End Function

End Class
